//
//  UITapImageView.m
//  easymarketing
//
//  Created by HailongHan on 14/12/26.
//  Copyright (c) 2014年 cubead. All rights reserved.
//

#import "UITapImageView.h"

@interface UITapImageView()

@property (nonatomic, copy) void(^tapAction)(id);

@end

@implementation UITapImageView

- (void)tapActionEvent{
    if (self.tapAction) {
        self.tapAction(self);
    }
}

- (void)addTargetBlock:(void (^)(id))action{
    self.tapAction = action;
    if (![self gestureRecognizers]) {
        self.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapActionEvent)];
        [self addGestureRecognizer:tap];
    }
}
@end
